package com.cornergj.interfaces.controller;

import java.io.File;
import java.io.IOException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.cornergj.model.Admin;
import com.cornergj.model.Entity;
import com.cornergj.model.Entity.AdminCriteria;
import com.cornergj.model.Entity.FrontImgCriteria;
import com.cornergj.model.Entity.OrderServiceCriteria;
import com.cornergj.model.Entity.Pagination;
import com.cornergj.model.Entity.ServiceContentCriteria;
import com.cornergj.model.Entity.UserQuestionCriteria;
import com.cornergj.model.Entity.Value;
import com.cornergj.model.FrontImg;
import com.cornergj.model.Nanny;
import com.cornergj.model.OrderService;
import com.cornergj.model.ServiceContent;
import com.cornergj.model.UserQuestion;
import com.cornergj.response.ErrorCode;
import com.cornergj.response.JsonResult;
import com.cornergj.service.AdminService;
import com.cornergj.service.FrontImgService;
import com.cornergj.service.NannyService;
import com.cornergj.service.OrderServiceService;
import com.cornergj.service.ServiceContentService;
import com.cornergj.service.UserQuestionService;
import com.cornergj.uitl.FileUtils;


/**
 * Title:
 * Model:
 * Description:
 * @author 郑耿杰
 * @date 2018年1月31日
 */
@Controller
@RequestMapping("/submitquestion")
public class QuestionController {
	
	@Autowired
	private ServiceContentService serviceContentService;
	@Autowired
	private UserQuestionService userQuestionService;
	/**
	 * 提交问题
	 * @param request
	 * @param bean
	 * @param pagination
	 * @return
	 */
	@RequestMapping(value = "/question", method = RequestMethod.GET)
	public String question(HttpServletRequest request, UserQuestion question) {
		try{
			question.setIsread(0);
			userQuestionService.save(question);
			request.setAttribute("Message","提交成功！管理员会尽快与您联系，请耐心等待");
			request.setAttribute("StatusImg","OK.png");
		}catch(Exception e){
			request.setAttribute("Message","提交失败！请稍后重试");
			request.setAttribute("StatusImg","NO.png");
		}
		return "front/registersuccess";
	}
}
